﻿import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { AppRouteGuard } from '@shared/auth/auth-route-guard';
import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
import { UsersComponent } from './users/users.component';
import { TenantsComponent } from './tenants/tenants.component';

@NgModule({
    imports: [
        RouterModule.forChild([
            {
                path: '',
                component: AppComponent,
                children: [
                    { path: 'home', component: HomeComponent, canActivate: [AppRouteGuard] },
                    { path: 'users', component: UsersComponent, data: { permission: 'Pages.Users' }, canActivate: [AppRouteGuard] },
                    { path: 'tenants', component: TenantsComponent, data: { permission: 'Pages.Tenants' }, canActivate: [AppRouteGuard] },
                    {
                        path: 'category',
                        loadChildren: './category/category.module#CategoryModule',
                        data: { permission: 'Pages.Users' },
                        canActivate: [AppRouteGuard]
                    },
                    {
                        path: 'product',
                        loadChildren: './product/product.module#ProductModule',
                        data: { permission: 'Pages.Users' },
                        canActivate: [AppRouteGuard]
                    },
                    {
                        path: 'classes',
                        loadChildren: './micro-class/micro-class.module#MicroClassModule',
                        data: { permission: 'Pages.Users' },
                        canActivate: [AppRouteGuard]
                    },
                    {
                        path: 'orders',
                        loadChildren: './orders/order.module#OrderModule',
                        data: { permission: 'Pages.Users' },
                        canActivate: [AppRouteGuard]
                    },
                    {
                        path: 'agents',
                        loadChildren: './agents/agents.module#AgentsModule',
                        data: { permission: 'Pages.Users' },
                        canActivate: [AppRouteGuard]
                    },
                    {
                        path: 'promotion',
                        loadChildren: './promotion/promotion.module#PromotionModule',
                        data: { permission: 'Pages.Users' },
                        canActivate: [AppRouteGuard]
                    },
                    {
                      path: 'clients',
                      loadChildren: './clients/clients.module#ClientsModule',
                      data: { permission: 'Pages.Users' },
                      canActivate: [AppRouteGuard]
                    },
                    {
                      path: 'wallets',
                      loadChildren: './wallets/wallets.module#WalletsModule',
                      data: { permission: 'Pages.Users' },
                      canActivate: [AppRouteGuard]
                    },
                    {
                      path: 'roles',
                      loadChildren: './roles/roles.module#RolesModule',
                      data: { permission: 'Pages.Users' },
                      canActivate: [AppRouteGuard]
                    },
                    { path: 'about', component: AboutComponent }
                ]
            }
        ])
    ],
    exports: [RouterModule]
})
export class AppRoutingModule { }
